package models

import (
	"time"
)

// OrderMessage 订单消息表
type OrderMessage struct {
	ID          uint64     `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"`
	OrderID     uint64     `gorm:"not null;index;comment:订单ID" json:"order_id"`
	SenderID    string     `gorm:"type:varchar(64);not null;index;comment:发送者ID" json:"sender_id"`
	ReceiverID  string     `gorm:"type:varchar(64);not null;index;comment:接收者ID" json:"receiver_id"`
	MessageType int8       `gorm:"type:tinyint;not null;index;comment:消息类型(1-文本,2-图片,3-文件,4-系统通知)" json:"message_type"`
	Title       string     `gorm:"type:varchar(200);comment:消息标题" json:"title"`
	Content     string     `gorm:"type:text;not null;comment:消息内容" json:"content"`
	Attachments string     `gorm:"type:json;comment:附件" json:"attachments"`
	IsRead      int8       `gorm:"type:tinyint;default:0;index;comment:是否已读(0-未读,1-已读)" json:"is_read"`
	ReadAt      *time.Time `gorm:"type:timestamp;comment:阅读时间" json:"read_at"`
	CreatedAt   time.Time  `gorm:"autoCreateTime;index;comment:创建时间" json:"created_at"`
}
